/**
 * 群列表菜单的管理
 */
/*
var groups = [];
var currGroup = {};

// 得到我的信息
var url = get_url("account/query");
$.ajax({
    url: url,
    type: "POST",
    dataType: "json",
    data: {
    },
    success: function(r) {
        if (r.code != 0 || r.data.length < 1) {
            return;
        }
        context.user = r.data[0];
        
        // 取得所有的群
        query_groups(function(list) {
            groups = [];
            for (var i in list) {
                if (list[i].owner != context.user.user.id) continue;
                groups.push(list[i]);
            }

            fill_group_data();
            fill_group_list();
        });
    }
});

function query_groups(cb) {
    var url = get_url("group/query-by-user");
    $.ajax({
        url: url,
        type: "POST",
        dataType: "json",
        data: {
        },
        success: function(r) {
            console.log('我的群', r);
            if (r.code == 0) cb(r.data);
        }
    });
}

function fill_group_data() {
    currGroup = {};
    for (var i in groups) {
        if (groups[i].id == urlInfo.params.group) {
            currGroup = groups[i];
            break;
        }
    }

    if (!isEmpty(currGroup)) {
        $(".game-title span").html(currGroup['name']);
        $("title").html(currGroup['name']);
    } 
    else {
        var name = decodeURI(urlInfo.params.groupName || '');
        $(".game-title span").html(name);
        $("title").html(name);
    }
}
fill_group_data();

function fill_group_list() {
    var f = function(key, name) {
        var l = '<li class="__k__"><a href="#" class="__k__">__name__</a></li>';
        l = l.replace(/__k__/g, key);
        l = l.replace(/__name__/g, name);
        $(".gamelist").append(l);
    }

    for (var i in groups) {
        var group = groups[i];
        if (group.id == currGroup.id) continue;
        f(group.id, group.name);
    }

    var cb = function(e) {
        var target = $(e.currentTarget);
        var gid = target.attr("class");
        if (gid == currGroup.id) return;
        if (gid == 'system') return;

        // 切换游戏
        jumpGroup(gid);
    };
    var arr = $(".gamelist li");
    for (var i = 0; i < arr.length; i++) {
        $(arr[i]).click(cb);
    }
}
*/